package com.teamin.web.interceptor;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.springframework.validation.BindingResult;

/**
 * Created by qfu on 2017/9/23.
 */
//@Aspect
//@Component
public class ControllerValidatorInterceptor {
    @Around("execution(* com.teamin.web.*.*(..)) && args(..,bindingResult)")
    public Object doAround(ProceedingJoinPoint pjp, BindingResult bindingResult) throws Throwable {
        Object retVal = null;
        if (bindingResult.hasErrors()) {
            System.out.println("---------------");
        } else {
            retVal = pjp.proceed();
        }
        return retVal;
    }
}
